package com.salim.summary.design.$2abstractFactory;

public class FactoryProducer {
    public AbstractVehicleFactory getVehicleFactory(String type){
        if(type.contains("car")){
            return new CarFactory();
        }else if(type.contains("plane")){
            return new PlaneFactory();
        }
        return null;
    }

    public static void main(String[] args){
        FactoryProducer factoryProducer = new FactoryProducer();
        AbstractVehicleFactory carFactory = factoryProducer.getVehicleFactory("car");
        AbstractVehicleFactory planeFactory = factoryProducer.getVehicleFactory("plane");
        carFactory.getCar("big").drive();
        planeFactory.getPlane("small").fly();
    }
}
